From d48d377bc4fc4c9b02c419aaedc1a82a73f564e4 Mon Sep 17 00:00:00 2001 From: Hollis Blanchard Date: Wed, 4 Oct 2006 17:22:59 -0500 Subject: [PATCH] [POWERPC][XEN] Create a cmdline.c to hold builtin/post-installed parameters. Signed-off-by: Hollis Blanchard --HG-- extra : transplant_source : %80%27K%ED%86%CA%17I%FE%29%E2%21G%CB%C7%C4%95%22%271 --- xen/arch/powerpc/Makefile | 8 +++++--- xen/arch/powerpc/boot_of.c | 19 +++++++++---------- xen/arch/powerpc/cmdline.c | 24 ++++++++++++++++++++++++ xen/include/asm-powerpc/config.h | 1 + 4 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 xen/arch/powerpc/cmdline.c diff --git a/xen/arch/powerpc/Makefile b/xen/arch/powerpc/Makefile index c25a8964ad..32a049c001 100644 --- a/xen/arch/powerpc/Makefile +++ b/xen/arch/powerpc/Makefile @@ -9,6 +9,7 @@ obj-y += audit.o obj-y += backtrace.o obj-y += bitops.o obj-y += boot_of.o +obj-y += cmdline.o obj-y += dart.o obj-y += dart_u3.o obj-y += dart_u4.o @@ -75,10 +76,11 @@ physdev.o: ../x86/physdev.c HDRS += $(wildcard *.h) +ifneq ($(CMDLINE),) # The first token in the arguments will be silently dropped. -IMAGENAME = xen -CMDLINE = "" -boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\"" +FULL_CMDLINE := xen $(CMDLINE) +endif +cmdline.o: CFLAGS += -DCMDLINE="\"$(FULL_CMDLINE)\"" TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,0x400000,-T,xen.lds TARGET_OPTS += start.o $(ALL_OBJS) diff --git a/xen/arch/powerpc/boot_of.c b/xen/arch/powerpc/boot_of.c index 8e5ff97e1a..623944b557 100644 --- a/xen/arch/powerpc/boot_of.c +++ b/xen/arch/powerpc/boot_of.c @@ -16,6 +16,7 @@ * Copyright (C) IBM Corp. 2005, 2006 * * Authors: Jimi Xenidis + * Hollis Blanchard */ #include @@ -40,12 +41,8 @@ volatile unsigned int __spin_ack; static ulong of_vec; static ulong of_msr; static int of_out; -static char bootargs[256]; - -#define COMMAND_LINE_SIZE 512 -static char builtin_cmdline[COMMAND_LINE_SIZE] - __attribute__((section("__builtin_cmdline"))) = CMDLINE; +extern char builtin_cmdline[]; extern struct ns16550_defaults ns16550; #undef OF_DEBUG @@ -464,15 +461,17 @@ static void boot_of_bootargs(multiboot_info_t *mbi) { int rc; - rc = of_getprop(bof_chosen, "bootargs", &bootargs, sizeof (bootargs)); - if (rc == OF_FAILURE || bootargs[0] == '\0') { - strlcpy(bootargs, builtin_cmdline, sizeof(bootargs)); + if (builtin_cmdline[0] == '\0') { + rc = of_getprop(bof_chosen, "bootargs", builtin_cmdline, + CONFIG_CMDLINE_SIZE); + if (rc > CONFIG_CMDLINE_SIZE) + of_panic("bootargs[] not big enough for /chosen/bootargs\n"); } mbi->flags |= MBI_CMDLINE; - mbi->cmdline = (u32)bootargs; + mbi->cmdline = (ulong)builtin_cmdline; - of_printf("bootargs = %s\n", bootargs); + of_printf("bootargs = %s\n", builtin_cmdline); } static int save_props(void *m, ofdn_t n, int pkg) diff --git a/xen/arch/powerpc/cmdline.c b/xen/arch/powerpc/cmdline.c new file mode 100644 index 0000000000..e7c1bdf74b --- /dev/null +++ b/xen/arch/powerpc/cmdline.c @@ -0,0 +1,24 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright (C) IBM Corp. 2006 + * + * Authors: Hollis Blanchard + */ + +#include + +char builtin_cmdline[CONFIG_CMDLINE_SIZE] + __attribute__((section("__builtin_cmdline"))) = CMDLINE; diff --git a/xen/include/asm-powerpc/config.h b/xen/include/asm-powerpc/config.h index 154938fe4d..b3b3671c1d 100644 --- a/xen/include/asm-powerpc/config.h +++ b/xen/include/asm-powerpc/config.h @@ -50,6 +50,7 @@ extern char __bss_start[]; #define CONFIG_GDB 1 #define CONFIG_SMP 1 #define CONFIG_PCI 1 +#define CONFIG_CMDLINE_SIZE 512 #define NR_CPUS 16 #ifndef ELFSIZE -- 2.30.2